package com.hgw.Demo11_VisitorPattern.Exercises26_7_4;

import java.util.ArrayList;

/**
 * Data time:2021/12/21 21:16
 * StudentID:2019112118
 * Author:hgw
 * Description: 购物车，充当对象结构
 */
public class ShoppingCart {
    private ArrayList<Commodity> commodities = new ArrayList<Commodity>();

    public void addCommodity(Commodity commodity) {
        commodities.add(commodity);
    }

    public void accept(People people) {
        for (Commodity commodity : commodities) {
            commodity.accept(people);
        }
    }
}
